﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LibGreen.Oscar.ObjectManagers.SSI
{
	public class Buddy : IServerSideItem
	{
		internal UserInfo User;
		private ushort _groupid = 0;

		/// <summary>
		/// The unique ID of the contact
		/// </summary>
		public readonly ushort ID;

		/// <summary>
		/// The ID of the contact's parent group
		/// </summary>
		public ushort GroupID
		{
			get { return _groupid; }
			set { _groupid = value; }
		}

		/// <summary>
		/// The contact's SMS information
		/// </summary>
		public string SMS = "";

		/// <summary>
		/// A locally assigned comment about this contact
		/// </summary>
		public string Comment = "";

		/// <summary>
		/// Two bytes representing the different possible alert styles
		/// </summary>
		public ushort Alerts = 0;

		/// <summary>
		/// A sound file to play when this contact signs on
		/// </summary>
		public string SoundFile = null;

		/// <summary>
		/// Indicates whether the local client is awaiting authorization by the remote contact
		/// </summary>
		public bool AwaitingAuthorization = false;

		/// <summary>
		/// The reason message that can be transmitted, if authorization is required
		/// </summary>
		public string AuthorizationReason = "";

		/// <summary>
		/// Creates a new Buddy object
		/// </summary>
		/// <param name="id">The ItemID for the object</param>
		public Buddy (ushort id)
		{
			this.ID = id;
		}

		#region IServerSideItem Members

		/// <summary>
		/// The unique ID of the contact
		/// </summary>
		public ushort ItemID
		{
			get { return ID; }
		}

		#endregion

		#region IComparable Members
		/// <summary>
		/// Compares the current instance with another object of the same type.
		/// </summary>
		/// <param name="obj">An object to compare with this instance.</param>
		/// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
		public int CompareTo (object obj)
		{
		    if (obj is Buddy) {
		        return this.ID.CompareTo ((obj as Buddy).ID);
		    }
		    return -1;
		}

		#endregion



	}
}
